﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Net;
using System.IO;

namespace QQ农场
{
    public class Common
    {        

        #region QQ登陆密码加密码
        public string getMd5Hash(string input)
        {
            MD5 md = MD5.Create();
            byte[] buffer = md.ComputeHash(Encoding.Default.GetBytes(input));
            buffer = md.ComputeHash(buffer);
            buffer = md.ComputeHash(buffer);
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < buffer.Length; i++)
            {
                builder.Append(buffer[i].ToString("x2"));
            }
            return builder.ToString();
        }

        public string getMd5Hash2(string input)
        {
            byte[] buffer = MD5.Create().ComputeHash(Encoding.Default.GetBytes(input));
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < buffer.Length; i++)
            {
                builder.Append(buffer[i].ToString("x2"));
            }
            return builder.ToString();
        }
        #endregion

        #region 获取好友列表
        public string getFriendList(string url, string postData, CookieContainer _cookieContainer)
        {
            string strHtml = string.Empty;
            HttpHelper _help = new HttpHelper(_cookieContainer);
            strHtml = _help.GetHtml(url, postData, true, _cookieContainer);
            return strHtml;
        }
        #endregion
    }
}
